﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace gChartSharp
{
    /// <summary>
    /// 
    /// </summary>
    public class SubRegionParam : IRenderable
    {
        /// <summary>
        /// The API text
        /// </summary>
        public string Name { get { return "chld"; } }


        /// <summary>
        /// States
        /// </summary>
        public List<US_State> US_States 
        {
            get { return mUS_States ?? (mUS_States = new List<US_State>()); }
            set { mUS_States = value; }
        }
        private List<US_State> mUS_States;


        /// <summary>
        /// Countries
        /// </summary>
        public List<Country> Countries
        {
            get { return mCountries ?? (mCountries = new List<Country>()); }
            set { mCountries = value; }
        }
        private List<Country> mCountries;


        /// <summary>
        /// The default constructor
        /// </summary>
        public SubRegionParam() { }


        /// <summary>
        /// Renders the API text
        /// </summary>
        /// <returns></returns>
        public string Render()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(string.Format("&{0}=", this.Name));

            if (US_States.Count > 0)
            {
                foreach (US_State state in this.US_States)
                    sb.Append(string.Format("{0}", state.ToString()));
            }
            else if (Countries.Count > 0)
            {
                foreach (Country country in this.Countries)
                    sb.Append(string.Format("{0}", country.ToString()));
            }

            return sb.ToString();
        }
    }


    /// <summary>
    /// All 50 United States
    /// </summary>
    public enum US_State
    {
        AL, AK, AZ, AR, CA, CO, CT, DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO,
        MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA, WV, WI, WY
    }


    /// <summary>
    /// TODO
    /// </summary>
    public enum Country
    {

    }
}
        